#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
struct Stu
{
	int id;
	char cla[50];
	char name[50];
	float score[3+2];
	float sumScore;
}stu[500];
int main()
{
	int i, n, maxIndex = -1;
	float maxSum = -1;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> stu[i].id >> stu[i].cla >> stu[i].name >> stu[i].score[0] >> stu[i].score[1] >> stu[i].score[2];
		stu[i].sumScore = stu[i].score[0] + stu[i].score[1] + stu[i].score[2];
		printf("%s %.1f\n", stu[i].name, stu[i].sumScore / 3);
	}
	for (i = 0; i < n; i++)
	{
		if (stu[i].sumScore > maxSum)
		{
			maxSum = stu[i].sumScore;
			maxIndex = i;
		}
	}
	printf("%d %s %s %.1f %.1f %.1f %.1f\n", stu[maxIndex].id,stu[maxIndex].cla,stu[maxIndex].name, stu[maxIndex].score[0], stu[maxIndex].score[1], stu[maxIndex].score[2],stu[maxIndex].sumScore/3);
	return 0;
}